package com.guaoran.distributed.concurrent.program.demo;

import java.util.concurrent.*;

/**
 * @author : guaoran
 * @Description : <br/>
 * @date :2019/2/26 10:54
 */
public class CallableDemo implements Callable<String> {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newCachedThreadPool();
        CallableDemo callableDemo = new CallableDemo();
        Future<String> f = executorService.submit(callableDemo);
        System.out.println(f.get());
        executorService.shutdown();
    }
    @Override
    public String call() throws Exception {
        return "test";
    }
}
